import {DispatcherUtils} from "../util/DispatcherUtils";
import {Event} from "../Event"

export class SoundData{
    static get effect(): number {
        let _effect = cc.sys.localStorage.getItem("effect");
        if(_effect==null || _effect == "") {
            _effect = 0;
        }
        return parseFloat(_effect);
    }

    static set effect(value: number) {
        cc.sys.localStorage.setItem("effect",value);
        DispatcherUtils.dispatchEvent(Event.SOUND_EFFECT_UPDATE)
    }

    static get music(): number {
        let _music = cc.sys.localStorage.getItem("music");
        if(_music==null || _music == "") {
            _music = 0;
        }
        return parseFloat(_music);
    }

    static set music(value: number) {
        cc.sys.localStorage.setItem("music",value);
        DispatcherUtils.dispatchEvent(Event.SOUND_MUSIC_UPDATE)
    }
}